home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zoom 2
/
Zoom - Release 2 (1996)(Active Software)[!].iso
/
misc
/
scion409
/
scionarexx.lha
/
FamilyGroup.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-10-25
|
12KB
|
438 lines
/****************************************************************************/
/* */
/* FamilyGroup.rexx */
/* */
/* Written by: Peter Billing, RMB 1240, Yinnar 3869, Australia */
/* */
/* Last saved: Wednesday 29-Sep-93 */
/* */
/* This program should make a Family Group from the Families in the SCION */
/* database. The database must be running for this AREXX script to work. */
/* */
/****************************************************************************/
/* Return the Database Name */
options results
/*test = show('P','SCIONGEN')
if test = 0 then
say
say "I am sorry to say that the SCION Genealogist database is not available."
say "Please start the SCION program BEFORE using this script."
say
exit */
myport = "SCIONGEN"
address value myport
getdbname
dbname = upper(result)
output = "STDOUT"
writeln(output, "")
writeln(output,center("This script will give you a",80))
heading = "Listing of a Family Group in the" dbname "database on" date()
writeln(output,center(heading,80))
writech(output,"Type in the FGRN of the Family Group you require or ALL for all. " )
pull FGRN
gettotalfgrn
total = result
if fgrn = "ALL" then do
start = 1
finish = total
end
if fgrn ~= "ALL" then do
start = fgrn
finish = fgrn
end
if fgrn ~= "ALL" & FGRN > total then do
say "I am sorry to say that there are only" total "Family Groups available. "
exit
end
writech(output, "Output to Screen or File S/F ")
pull out
if out = "" then out = "S"
writech(stdout,"Do you want a sorted list Y/N ")
pull sorted
if sorted = "" then sorted = "N"
if sorted = "Y" then do
file_name = "ram:sort"
open(sort_File,file_Name,"w")
do x = 1 to total
getprincipal x
a = result
getsex a
sex = result
if sex = "F" then do
getspouse x
a = result
end
getlastname a
person = upper(result)
getfirstname a
person = person result x
writeln(sort_File,person)
end
close(sort_file)
address command "c:sort ram:sort ram:sort2"
file_name = "ram:sort2"
open(sort_File,file_Name,"r")
end
output = "STDOUT"
code1 = "
" /* Bold */
code2 = "" /* Normal */
if out = "F" then do
code1 = "
" /* Bold on */
code2 = "
" /* Bold off */
filename = "RAM:FamilyGroup_"dbname"_"fgrn".Scion"
open(w_file,filename,"w")
output = w_file
writeln(stdout,"")
writeln(stdout,"Writing file to" filename)
end
do j = start to finish
if sorted = "Y" then do
person = readln(sort_file)
fgrn = word(person,words(person))
end
else do
fgrn = j
end
if out = "F" then writech(stdout,".")
writeln(output,"")
heading = "Family Group" fgrn "in the" database "database on" date()
writeln(output,center(heading" Page: 1",80))
writeln(output,"")
getprincipal fgrn
p = result
MakeName(p)
principal = name
getspouse fgrn
s = result
MakeName(s)
spouse = name
getsex s
if result = "M" then do /* do a swap if the Spouse is MALE */
temp = spouse
spouse = principal /* swap Principal and Spouse */
principal = temp
t = s
s = p /* swap their irn's */
p = t
end
sp = 3
getage(p)
writeln(output,"--------------------------------------------------------------------------------")
writeln(output,code1"PRINCIPAL:"code2 principal " ["p"] Age:" age Life)
writeln(output,"--------------------------------------------------------------------------------")
getbirthdate p
birthdate = result
getbirthplace p
birthplace = result
writeln(output,right(" ",sp)left("Born:",12) right(birthdate,14) right("Place:",8) birthplace)
getdeathdate p
deathdate = result
getdeathplace p
deathplace = result
writeln(output,right(" ",sp)left("Died:",12) right(deathdate,14) right("Place:",8) deathplace)
getburialdate p
burialdate = result
getburialplace p
burialplace = result
writeln(output,right(" ",sp)left("Buried:",12) right(burialdate,14) right("Place:",8) burialplace)
getpersuser1 p
user1 = result
writeln(output,right(" ",sp)left("Occupation:",12) user1)
getpersuser2 p
user2 = result
writeln(output,right(" ",sp)left("Comments:",12) user2)
getpersuser3 p
user3 = result
writeln(output,right(" ",sp)left("References:",12) user3)
getparents p
parents = result
getprincipal parents
p1 = result
MakeName(p1)
principalParent = name
getspouse parents
s1 = result
MakeName(s1)
spouseParent = name
getsex s1
if result = "M" then do
temp = spouseParent
spouseParent = principalParent
principalParent = temp
t = s1
s1 = p1
p1 = t1
end
writeln(output,right(" ",sp)left("Parents:",12) PrincipalParent "["p1"]")
writeln(output,right(" ",sp)right(" ",12) SpouseParent "["s1"]")
getmarrydate fgrn
marrydate = result
getmarryplace fgrn
marryplace = result
writeln(output,right(" ",sp)left("Married:",12) right(marrydate,14) right("Place:",8) marryplace)
getfamuser1 fgrn
user1 = result
writeln(output,right(" ",sp)left("Celebrant:",12) user1)
getfamuser2 fgrn
user2 = result
writeln(output,right(" ",sp)left("Comments:",12) user2)
writeln(output,"--------------------------------------------------------------------------------")
writech(output,right(" ",sp)"Other Marriages: ")
fix = 0
do m = 0 to 9
getmarriage p m
if result ~= "" & result ~= fgrn then do /* only display marriages apart */
/* from the present */
writech(output," ["result"]")
fix = 1
end
end
if fix = 1 then writeln(output,"")
else
writeln(output,"None recorded.")
getage(s)
writeln(output,"================================================================================")
writeln(output,code1"SPOUSE: "code2 spouse " ["s"] Age:" age Life)
writeln(output,"--------------------------------------------------------------------------------")
getbirthdate s
birthdate = result
getbirthplace s
birthplace = result
writeln(output,right(" ",sp)left("Born:",12) right(birthdate,12) right("Place:",8) birthplace)
getdeathdate s
deathdate = result
getdeathplace s
deathplace = result
writeln(output,right(" ",sp)left("Died:",12) right(deathdate,12) right("Place:",8) deathplace)
getburialdate s
burialdate = result
getburialplace s
burialplace = result
writeln(output,right(" ",sp)left("Buried:",12) right(burialdate,12) right("Place:",8) burialplace)
getpersuser1 s
user1 = result
writeln(output,right(" ",sp)left("Occupation:",12) user1)
getpersuser2 s
user2 = result
writeln(output,right(" ",sp)left("Comments:",12) user2)
getpersuser3 s
user3 = result
writeln(output,right(" ",sp)left("References:",12) user3)
getparents s
parents = result
getprincipal parents
p1 = result
MakeName(p1)
principalParent = name
getspouse parents
s1 = result
MakeName(s1)
spouseParent = name
getsex s1
if result = "M" then do
temp = spouseParent
spouseParent = principalParent
principalParent = temp
t = s1
s1 = p1
p1 = t1
end
writeln(output,right(" ",sp)left("Parents:",12) PrincipalParent "["p1"]")
writeln(output,right(" ",sp)right(" ",12) SpouseParent "["s1"]")
writeln(output,"--------------------------------------------------------------------------------")
fix = 0
writech(output,right(" ",sp)"Other Marriages: ")
do m = 0 to 9
getmarriage s m
if result ~= "" & result ~= fgrn then do
writech(output," ["result"]")
fix = 1
end
end
if fix = 1 then writeln(output,"")
else
writeln(output,"None recorded.")
writeln(output,"================================================================================")
writeln(output,center("Details of Children",80))
writeln(output,"================================================================================")
sp = 6
page = 2
do child = 0 to 39
getchild fgrn child
/* say (child-4)/9 (child-4)%9 */
if result > 0 then do
c = result
if out = "F" & (child-4)/8 = (child-4)%8 then do
writeln(output,"")
writeln(output,center(heading" cont. Page: "page,80))
writeln(output,"")
writeln(output,"--------------------------------------------------------------------------------")
page = page + 1
end
MakeName(c)
getsex c
sex = result
getage(c)
writeln(output,right(" ",sp)left("Name:",7) name "["c"] Sex:" sex " Age:" age life)
getbirthdate c
birthdate = result
getbirthplace c
birthplace = result
writeln(output,right(" ",sp)left("Born:",7) right(birthdate,12) right("Place:",8) birthplace)
getdeathdate c
deathdate = result
getdeathplace c
deathplace = result
writeln(output,right(" ",sp)left("Died:",7) right(deathdate,12) right("Place:",8) deathplace)
marrydate = ""
marryplace = ""
spouse = ""
name = ""
getmarriage c
if result > 0 then do
fg = result
getmarrydate fg
marrydate = result
getmarryplace fg
marryplace = result
getspouse fg
spouse = result
getsex spouse
if sex = result then do
getprincipal fg
spouse = result
end
MakeName(spouse)
end
writeln(output,right(" ",sp)left("Marr:",7) right(marrydate,12) right("Place:",8) marryplace)
writech(output,right(" ",sp)left("Spse:",7) )
if spouse > 0 then do
writeln(output," "name "["spouse"]")
end
else
writeln(output,"")
fix = 0
do f = 0 to 9
getmarriage c f
marriage = result
if marriage ~= "" & marriage ~= fg then do
if fix = 0 then do
writech(output,right(" ",sp)"Other Marriages: ")
fix = 1
end
writech(output," ["marriage"]")
end
end
if fix = 1 then writeln(output,"")
writeln(output,"--------------------------------------------------------------------------------")
end
end
end
if out = "F" then do
writeln(output,"")
close(w_file)
writeln(stdout,"")
writeln(stdout,"All Finished")
end
exit
MakeName:
parse arg irn
getfirstname irn
name = left(result,25)
getlastname irn
name = name code1 left(result,13)code2
return name
GetAge:
parse arg irn
age = ""
life = ""
day1 = substr(date(),1,2)
Month1 = substr(date(),4,3)
Year1 = substr(date(),8,4)
CheckMonth(upper(Month1)) /* turn the month into a number */
m1 = x
birth = ""
getbirthdate irn
birth = result
if birth ~= "" then do
if length(birth) > 3 then do /* check if there is a date */
day2 = word(birth,1) /* if there is then continue */
Month2 = substr(word(birth,2),1,3)
Year2 = substr(birth,length(birth)-3,4)
CheckMonth(upper(Month2))
m2 = x
end
else do /* no date */
break /* no need going any futher */
end
death = ""
getdeathdate irn
death = result
if length(death) > 3 then do /* is if the person has a death date */
day3 = word(death,1) /* if there is a date then work out */
Month3 = word(death,2) /* age at death */
Year3 = substr(death,length(death)-3,4)
CheckMonth(upper(Month3))
m3 = x
age = year3 - year2
if m3 < m2 then age = age -1
if m3 = m2 then do
if day3 < day2 then age = age -1
end
Life = "D"
end
/* Person is still alive */
if length(death) < 3 & length(birth) > 3 then do /* check there is a bith date */
age = year1 - year2 /* work out the age using the year */
Life = "L"
if m1 < m2 then /* if birth month is less than today */
age = age -1 /* then person is a year younger */
if m1 = m2 then do /* if the months are the same then */
/* check the days */
if day1 < day2 then do /* if birth day is less than today */
age = age -1 /* then person is a year younger */
end
end
end
if age > 105 then do
age = ""
Life = ""
end
end
return age
CheckMonth:
parse arg m
if m = "JAN" then x = 1
if m = "FEB" then x = 2
if m = "MAR" then x = 3
if m = "APR" then x = 4
if m = "MAY" then x = 5
if m = "JUN" then x = 6
if m = "JUL" then x = 7
if m = "AUG" then x = 8
if m = "SEP" then x = 9
if m = "OCT" then x = 10
if m = "NOV" then x = 11
if m = "DEC" then x = 12
return x